#include "globals.h"
#include "boids.h"
#include "AE.h"
#include <iostream>

IGUIButton* resetButton = 0;
IGUIStaticText* txtRange_cohes = 0;
IGUIScrollBar* sbRange_cohes = 0;
IGUIStaticText* txtScale_cohes = 0;
IGUIScrollBar* sbScale_cohes = 0;
IGUIStaticText* txtRange_Sep = 0;
IGUIScrollBar* sbRange_Sep = 0;
IGUIStaticText* txtScale_Sep = 0;
IGUIScrollBar* sbScale_Sep = 0;
IGUIStaticText* txtRange_Align = 0;
IGUIScrollBar* sbRange_Align = 0;
IGUIStaticText* txtScale_Align = 0;
IGUIScrollBar* sbScale_Align = 0;
void makeBoidGui(dimension2d<s32>& windowSize)
{
	s32 length = 200;
	IGUIFont* proggyFont = guiEnv->getFont("media/proggyFontIrr.xml");
	/*
	
	range_cohes, scaleFac_cohes, range_sep, scaleFac_sep, range_align, scaleFac_align
		
	float range_sep = 200.0f;
	float range_align = 400.0f;
	float range_cohes = 400.0f;
	float scaleFac_sep = 200.0f;
	float scaleFac_align = .003f;
	float scaleFac_cohes = .005f;
	
	*/

	resetButton = guiEnv->addButton(rect<s32>(length/2 - 50, 195, length/2 + 50, 210), 0, 10, L"Reset C,S,A Values");

			////////////////////////////////////COHESION//////////////////////////////////////////////
//------------------------------------------------------------------------------------------------------------------------
	txtRange_cohes = guiEnv->addStaticText(L"Range of Cohesion", rect<s32>(0, 0, length, 30), 
		true, false, 0, 1, true);
	txtRange_cohes->setOverrideFont(proggyFont);

	sbRange_cohes = guiEnv->addScrollBar(true, rect<s32>(0, 15, length, 30), 0, 1);
	sbRange_cohes->setToolTipText(stringw(range_cohes).c_str());
	sbRange_cohes->setMax(1000);
	sbRange_cohes->setEnabled(true);
	sbRange_cohes->setSmallStep(1);
	sbRange_cohes->setLargeStep(100);
	#ifdef DEBUG
		std::cout<<"The sbRange_cohes ID is: "<< sbRange_cohes->getID()<<std::endl;
	#endif
	sbRange_cohes->setPos(s32(range_cohes));
//------------------------------------------------------------------------------------------------------------------------
	txtScale_cohes = guiEnv->addStaticText(L"Scaling of Cohesion", rect<s32>(0, 30, length, 60), 
		true, false, 0, 1, true);
	txtScale_cohes->setOverrideFont(proggyFont);
	
	sbScale_cohes = guiEnv->addScrollBar(true, rect<s32>(0, 45, length, 60), 0, 2);
	sbScale_cohes->setToolTipText(stringw(scaleFac_cohes).c_str());
	sbScale_cohes->setMax(10); //divide by 1000 (.01f - .001f). Recommended value is .005f
	sbScale_cohes->setEnabled(true);
	sbScale_cohes->setSmallStep(1);
	sbScale_cohes->setLargeStep(2);
	#ifdef DEBUG
		std::cout<<"The sbScale_cohes ID is: "<< sbScale_cohes->getID()<<std::endl;
	#endif
	sbScale_cohes->setPos(s32(scaleFac_cohes*1000));
//------------------------------------------------------------------------------------------------------------------------
			////////////////////////////////////SEPERATION//////////////////////////////////////////////
//------------------------------------------------------------------------------------------------------------------------
	txtRange_Sep = guiEnv->addStaticText(L"Range of Seperation", rect<s32>(0, 60, length, 90), 
		true, false, 0, 1, true);
	txtRange_Sep->setOverrideFont(proggyFont);

	sbRange_Sep = guiEnv->addScrollBar(true, rect<s32>(0, 75, length, 90), 0, 3);
	sbRange_Sep->setToolTipText(stringw(range_sep).c_str());
	sbRange_Sep->setMax(1000); //recommended value is 200
	sbRange_Sep->setEnabled(true);
	sbRange_Sep->setSmallStep(1);
	sbRange_Sep->setLargeStep(100);
	#ifdef DEBUG
		std::cout<<"The sbRange_Sep ID is: "<< sbRange_Sep->getID()<<std::endl;
	#endif
	sbRange_Sep->setPos(s32(range_sep));
//------------------------------------------------------------------------------------------------------------------------
	txtScale_Sep = guiEnv->addStaticText(L"Scaling of Seperation", rect<s32>(0, 90, length, 120), 
		true, false, 0, 1, true);
	txtScale_Sep->setOverrideFont(proggyFont);
	
	sbScale_Sep = guiEnv->addScrollBar(true, rect<s32>(0, 105, length, 120), 0, 4);
	sbScale_Sep->setToolTipText(stringw(scaleFac_sep).c_str());
	sbScale_Sep->setMax(1000); //recommended value is 200
	sbScale_Sep->setEnabled(true);
	sbScale_Sep->setSmallStep(1);
	sbScale_Sep->setLargeStep(100);
	#ifdef DEBUG
		std::cout<<"The sbScale_Sep ID is: "<< sbScale_Sep->getID()<<std::endl;
	#endif
	sbScale_Sep->setPos(s32(scaleFac_sep));
//------------------------------------------------------------------------------------------------------------------------
			////////////////////////////////////ALIGNMENT//////////////////////////////////////////////
//------------------------------------------------------------------------------------------------------------------------
	txtRange_Align = guiEnv->addStaticText(L"Range of Alignment", rect<s32>(0, 120, length, 150), 
		true, false, 0, 1, true);
	txtRange_Align->setOverrideFont(proggyFont);

	sbRange_Align = guiEnv->addScrollBar(true, rect<s32>(0, 135, length, 150), 0, 5);
	sbRange_Align->setToolTipText(stringw(range_align).c_str());
	sbRange_Align->setMax(1000); //recommended value is 400
	sbRange_Align->setEnabled(true);
	sbRange_Align->setSmallStep(1);
	sbRange_Align->setLargeStep(100);
	#ifdef DEBUG
		std::cout<<"The sbRange_Align ID is: "<< sbRange_Align->getID()<<std::endl;
	#endif
	sbRange_Align->setPos(s32(range_align));
//------------------------------------------------------------------------------------------------------------------------
	txtScale_Align = guiEnv->addStaticText(L"Scaling of Alignment", rect<s32>(0, 150, length, 180), 
		true, false, 0, 1, true);
	txtScale_Align->setOverrideFont(proggyFont);
	
	sbScale_Align = guiEnv->addScrollBar(true, rect<s32>(0, 165, length, 180), 0, 6);
	sbScale_Align->setToolTipText(stringw(scaleFac_align).c_str());
	sbScale_Align->setMax(10); //divide by 1000 (.01f - .001f). Recommended value is .003f
	sbScale_Align->setEnabled(true);
	sbScale_Align->setSmallStep(1);
	sbScale_Align->setLargeStep(2);
	#ifdef DEBUG
		std::cout<<"The sbScale_Align ID is: "<< sbScale_Align->getID()<<std::endl;
	#endif
	sbScale_Align->setPos(s32(scaleFac_align*1000));
//------------------------------------------------------------------------------------------------------------------------
	
	position2d<s32> moveAmount(windowSize.Width- (length + 10), windowSize.Height - 225);
	
	resetButton->move(moveAmount);
	txtRange_cohes->move(moveAmount);
	sbRange_cohes->move(moveAmount);
	txtScale_cohes->move(moveAmount);
	sbScale_cohes->move(moveAmount);
	txtRange_Sep->move(moveAmount);
	sbRange_Sep->move(moveAmount);
	txtScale_Sep->move(moveAmount);
	sbScale_Sep->move(moveAmount);
	txtRange_Align->move(moveAmount);
	sbRange_Align->move(moveAmount);
	txtScale_Align->move(moveAmount);
	sbScale_Align->move(moveAmount);



}